import { lazy } from 'react'
import { Navigate } from 'react-router-dom'
import AuthRoute from '../components/AuthRoute'

const Home = lazy(() => import('@/views/home/Home'))
const Cart = lazy(() => import('@/views/cart/Cart'))
const Mine = lazy(() => import('@/views/mine/Mine'))
const Login = lazy(() => import('@/views/mine/login/Login'))
// const Regist = lazy(() => import('@/views/mine/regist/Regist'))
const Detail = lazy(() => import('@/views/home/detail/Detail'))
const Address = lazy(() => import('@/views/mine/address/Address'))
const Order = lazy(() => import('@/views/mine/order/Order'))
const Search = lazy(() => import('@/views/home/search/Search'))
const Step1 = lazy(() => import('@/views/mine/regist/step/Step1'))
const Step2 = lazy(() => import('@/views/mine/regist/step/Step2'))
const Step3 = lazy(() => import('@/views/mine/regist/step/Step3'))

export const routes = [
    {
        path: '/home',
        element: <Home></Home>
    },
    {
        path: '/cart',
        element: <AuthRoute><Cart></Cart></AuthRoute>
    },
    {
        path: '/mine',
        element: <Mine></Mine>
    },
    {
        path: '/login',
        element: <Login></Login>
    },
    {
        path: '/regist',
        // element: <Regist></Regist>,
        children: [
            {
                path: 'step1',
                element: <Step1></Step1>
            },
            {
                path: 'step2',
                element: <Step2></Step2>
            },
            {
                path: 'step3',
                element: <Step3></Step3>
            },
            {
                path: '',
                element: <Navigate to='step1' />
            }
        ]
    },
    {
        path: '/details/:proid',
        element: <Detail></Detail>
    },
    {
        path: '/address',
        element: <Address></Address>
    },
    {
        path: '/order',
        element: <Order></Order>
    },
    {
        path: '/search',
        element: <Search></Search>
    },
    {
        path: '/',
        element: <Navigate to='/home' />
    }
]